﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using System.IO;
using System.Xml;
using BLL;
using DAL;
using Models;
using System.Data;
using Web.Old_App_Code;
using System.Collections;

public partial class cn_order_result : System.Web.UI.Page
{
    // Fields

    protected OrderManager om = new OrderManager();

    // Methods
    protected StringBuilder OrderBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            if (base.Request.QueryString["orderNo"] == null)
            {
                return builder;
            }
            DataTable orderByOrderNo = this.om.GetOrderByOrderNo(base.Request.QueryString["orderNo"]);
            if (orderByOrderNo.Rows.Count <= 0)
            {
                return builder;
            }
            DataRow row = orderByOrderNo.Rows[0];
            builder.AppendLine("<table class=\"secondtable\">");
            builder.AppendLine("<tr>");
            builder.AppendLine("<th>订单编号</th>");
            builder.AppendLine("<th>订单总金额</th>");
            builder.AppendLine("<th>配送方式</th>");
            builder.AppendLine("<th>支付方式</th>");
            builder.AppendLine("</tr>");
            builder.AppendLine("<tr>");
            builder.AppendLine(string.Concat(new object[] { "<td>", row["orderNo"], "<a href=\"/cn/member_center/order_info.html?orderNo=", base.Request.QueryString["orderNo"], "\" target=\"_blank\">[查看订单详情]</a></td>" }));
            builder.AppendLine("<td><strong>" + string.Format("{0:C}", Convert.ToDecimal(row["orderTotal"])) + "</strong></td>");
            builder.AppendLine("<td>" + row["deliveryWay"] + "</td>");
            builder.AppendLine("<td>" + row["payment"] + "</td>");
            builder.AppendLine("</tr>");
            builder.AppendLine("</table>");
            builder.AppendLine(string.Concat(new object[] { "<p><span>商品数量总计：<strong>", row["goodsEntityCount"], "</strong>件</span><span>赠送积分总计：<strong>", row["presentedIntegra"], "</strong>分</span><span>应付金额：<strong>", string.Format("{0:C}", Convert.ToDecimal(row["orderTotal"])), "</strong>(含运费:", string.Format("{0:C}", Convert.ToDecimal(row["deliveryMoney"])), ")</span></p>" }));
            if (Convert.ToInt32(row["payStatus"]) == 0)
            {
                builder.AppendLine("<p class=\"textright\"><input id=\"btnOrderPay\" type=\"submit\" class=\"saile_submit\" value=\"立即支付\" /></p>");
            }
            else if (Convert.ToInt32(row["payStatus"]) == 1)
            {
                builder.AppendLine("<p class=\"textright\"><input class=\"saile_submit\" type=\"button\" value=\"已支付\" disabled=\"disabled\" /></p>");
            }
            builder.AppendLine("<input id=\"hdfOrderNo\" type=\"hidden\" value=\"" + base.Request.QueryString["orderNo"] + "\" />");
            builder.AppendLine("<input id=\"hdfPayment\" type=\"hidden\" value=\"" + row["payment"] + "\" />");
            builder.AppendLine("<input id=\"hdfPayBank\" type=\"hidden\" value=\"" + row["payBank"] + "\" />");
        }
        catch
        {
        }
        return builder;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session["user"] == null)
        {
            base.Response.Redirect("web_login.html?ru=" + HttpContext.Current.Request.Url.PathAndQuery.Replace("aspx", "html"));
        }
    }

}